package name.sra.listener;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;

public class EraserListener implements MouseListener {

	private BufferedImage bi;
	
	public EraserListener(BufferedImage bi) {
		super();
		this.bi = bi;
	}

	@Override
	public void mouseClicked(MouseEvent event) {
		int SIDE = 40;
		for (int i = 0; i < SIDE; i++) {
			for (int j = 0; j < SIDE; j++) {
				bi.setRGB(event.getX() + i, event.getY() + j, 0);
			}
		}
		event.getComponent().repaint();
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

}
